home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / surfmodl / surfm203.arc / SURFSRC.ARC / WIREFRAM.INC < prev    next >
Text File  |  1988-01-30  |  2KB  |  56 lines

  1. procedure WIREFRAME;
  2.  
  3. { Make a wireframe drawing of the object }
  4. var Node:                      integer;       { node # }
  5.     Surf:                      integer;       { surface # }
  6. label ABORTTEXT,                              { text-mode abort }
  7.       ABORTGRPH;                              { graphics-mode abort }
  8.  
  9. begin
  10. {$ifdef BIGMEM}
  11. with ptra^ do with ptrb^ do with ptrc^ do
  12. with ptrd^ do with ptre^ do with ptrf^ do
  13. with ptri^ do
  14. begin
  15. {$endif}
  16.   if (Viewchanged) then begin
  17.     menumsg ('Transforming to 2-D...');
  18.     if (checkey) then goto ABORTTEXT;
  19. { Transform from 3-D to 2-D coordinates }
  20.     setorigin;
  21.     for Node := 1 to Nnodes do
  22.       perspect (Xworld[Node], Yworld[Node], Zworld[Node],
  23.                 Xtran[Node],  Ytran[Node],  Ztran[Node]);
  24.  
  25. { Set plotting limits and normalize transformed coords to screen coords }
  26.     perspect (Xfocal, Yfocal, Zfocal, Xfotran, Yfotran, Zfotran);
  27.     if (not setnormal (Xfotran, Yfotran, XYmax)) then begin
  28.       menumsg ('Warning: Focal point outside data limits.');
  29.       writeln;
  30.       write   ('  Press any key ...');
  31.       while (not keypressed) do;
  32.     end;
  33.  
  34.     if (checkey) then goto ABORTTEXT;
  35. { Normalize all the nodes }
  36.     for Node := 1 to Nnodes do
  37.       normalize (Xtran[Node], Ytran[Node], Xfotran, Yfotran, XYmax);
  38.   end; { if Viewchanged }
  39.  
  40. { Draw the outline of each surface }
  41.   setgmode;
  42.   for Surf := 1 to Nsurf do begin
  43.     border (Surf, Color[Matl[Surf]]);
  44.     if (grafstat) then goto ABORTGRPH;
  45.   end;
  46.   drawaxes (Xfotran, Yfotran, XYmax);
  47. { Wait for user keypress to continue }
  48.   continue;
  49.   ABORTGRPH:
  50.   exgraphic;
  51.   ABORTTEXT:
  52. {$ifdef BIGMEM}
  53. end; {with}
  54. {$endif}
  55. end; {procedure WIREFRAME }
  56.